<template>
  <h1>菜单组件</h1>
  <el-menu mode="horizontal" background-color="#4F8DFE" text-color="#fff" active-text-color="#ff0" @select="handleSelect"
           :default-active="defaultActiveIndex">
    <el-menu-item index="1" >黄霄雲</el-menu-item>
    <el-menu-item index="2">孙雪宁</el-menu-item>
    <el-menu-item index="3">李庚希</el-menu-item>
    <el-menu-item index="4">刘浩存</el-menu-item>
    <el-menu-item index="5">单依纯</el-menu-item>
    <el-sub-menu index="6">
      <template #title>郭伟杰</template>
      <el-menu-item index="6-1">毛晓彤</el-menu-item>
      <el-menu-item index="6-2">关晓彤</el-menu-item>
      <el-menu-item index="6-3">容祖儿</el-menu-item>
      <el-menu-item index="6-4">赵今麦</el-menu-item>
    </el-sub-menu>
  </el-menu>
</template>
<script setup>
import {ref} from "vue";
const defaultActiveIndex = ref("3");
//index指的是用户选择的是哪个菜单项,对应菜单项index的值,比如 3表示选择了"直播课"
//indexPath指的是如何到达当前这个菜单项,比如 [6,6-2]可到达"JSDTN2406"
const handleSelect = (key, keyPath)=>{
  console.log(key, keyPath);
}
</script>
<style scoped>

</style>